Skip to content

gh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replaced on disk#151032

Merged
pablogsal merged 6 commits into
python:mainfrom
ambv:remote-exec-on-deleted-elf
Jun 27, 2026
Merged

gh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replaced on disk#151032
pablogsal merged 6 commits into
python:mainfrom
ambv:remote-exec-on-deleted-elf

Conversation

@ambv

@ambv ambv commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

In the case where /proc/<pid>/maps points at a libpython that got deleted from disk or replaced with a new file, sys.remote_exec() used to fail to find the remote memory address to write the debug script path to.

This change makes it able to recover and read this information from the remote process' memory. See issue for rationale and details.

@ambv ambv added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 6, 2026
@johnslavik johnslavik self-requested a review June 7, 2026 03:21

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I reiewed it a couple of times and couldn't find anything. Tested also locally. I pushed a small follow-up that factors the duplicated deleted-mapping remote-exec test flow into a shared helper.

@pablogsal pablogsal enabled auto-merge (squash) June 27, 2026 15:51
@pablogsal pablogsal merged commit a69d0fc into python:main Jun 27, 2026
58 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @ambv for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @ambv and @pablogsal, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a69d0fc41ef339378022f1c0190a9692cb276a7f 3.14

@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

GH-152443 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 27, 2026
pablogsal added a commit that referenced this pull request Jun 27, 2026
…y when libpython replaced on disk (GH-151032) (#152443)

gh-151029: Fix sys.remote_exec() unable to find writable memory when libpython replaced on disk (GH-151032)
(cherry picked from commit a69d0fc)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
@bedevere-app

bedevere-app Bot commented Jun 28, 2026

Copy link
Copy Markdown

GH-152464 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 28, 2026
pablogsal pushed a commit that referenced this pull request Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants